#!/usr/bin/python
# encoding: utf-8
'''
@File    :   code.py
@Time    :   2020/03/11 21:54:19
@Author  :   fangkaijin 
@Version :   1.0
@Contact :   fangkaijin@gmail.com
@License :   杭州移动互联
@Desc    :   None
'''

# 导入库包

import sys, os

print(os.getcwd())
os.chdir('/Users/fangkaijin/Downloads/')
print(os.getcwd())

#读数据
with open('pytest.txt', 'r') as f:
    while True:
        line = f.readline()
        if line:
            print(line)
        else:
            break

#写数据
with open('pytest.txt', 'a+') as f:
    f.writelines('123456\n')